#include<iostream>
#include<cmath>
#include<cstring>
using namespace std;
const int N = 15;
int g[N][N];
int n, m;
int k;
bool fun(int x, int y)
{
	int blank = 0;
	int ans = g[x][y];
	bool flag = 0;
	if (g[x][y] == 0) {
		blank++;
	}
	for (int i = 1; i <= 4; i++) {
		if (g[x - i][y] == 0) {
			blank++;
		}
		ans += g[x - i][y];
	}
	k = 1;
	if (blank <= 1 && (ans == 4 || ans == 8))flag = 1;

	blank = 0;
	ans = g[x][y];
	if (g[x][y] == 0) {
		blank++;
	}
	for (int i = 1; i <= 4; i++) {
		if (g[x + i][y] == 0) {
			blank++;
		}
		ans += g[x + i][y];
	}
	k = 2;
	if (blank <= 1 && (ans == 4 || ans == 8))flag = 1;


	blank = 0;
	ans = g[x][y];
	if (g[x][y] == 0) {
		blank++;
	}
	for (int i = 1; i <= 4; i++) {
		if (g[x][y - i] == 0) {
			blank++;
		}
		ans += g[x][y - i];
	}
	k = 3;
	if (blank <= 1 && (ans == 4 || ans == 8))flag = 1;
	
	blank = 0;
	ans = g[x][y];
	if (g[x][y] == 0) {
		blank++;
	}
	for (int i = 1; i <= 4; i++) {
		if (g[x][y + i] == 0) {
			blank++;
		}
		ans += g[x][y + i];
	}
	k = 4;
	if (blank <= 1 && (ans == 4 || ans == 8))flag = 1;

	blank = 0;
	ans = g[x][y];
	if (g[x][y] == 0) {
		blank++;
	}
	for (int i = 1; i <= 4; i++) {
		if (g[x - i][y - i] == 0) {
			blank++;
		}
		ans += g[x - i][y - i];
	}
	k = 5;
	if (blank <= 1 && (ans == 4 || ans == 8))flag = 1;

	blank = 0;
	ans = g[x][y];
	if (g[x][y] == 0) {
		blank++;
	}
	for (int i = 1; i <= 4; i++) {
		if (g[x + i][y + i] == 0) {
			blank++;
		}
		ans += g[x + i][y + i];
	}
	k = 6;
	if (blank <= 1 && (ans == 4 || ans == 8))flag = 1;

	blank = 0;
	ans = g[x][y];
	if (g[x][y] == 0) {
		blank++;
	}
	for (int i = 1; i <= 4; i++) {
		if (g[x - i][y + i] == 0) {
			blank++;
		}
		ans += g[x - i][y + i];
	}
	k = 7;
	if (blank <= 1 && (ans == 4 || ans == 8))flag = 1;

	blank = 0;
	ans = g[x][y];
	if (g[x][y] == 0) {
		blank++;
	}
	for (int i = 1; i <= 4; i++) {
		if (g[x + i][y - i] == 0) {
			blank++;
		}
		ans += g[x + i][y - i];
	}
	k = 8;
	if (blank <= 1 && (ans == 4 || ans == 8))flag = 1;
	if (flag)return 1;
	return 0;
}
int main()
{
	memset(g, 100, sizeof(g));
	for (int i = 1; i <= 12; i++) {
		for (int j = 1; j <= 12; j++) {
			cin >> g[i][j];
		}
	}
	for (int i = 1; i <= 12; i++) {	
		for (int j = 1; j <= 12; j++) {
			if (fun(i, j)) {
				cout << "YES" << endl;
				//cout << "i  j  " << i << "  " << j << endl;
				//cout << "kkk" << k << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}